{
  "properties" : { },
  "id" : "72f2418fbd0046fdbc3e8c070283ddc4",
  "script" : null,
  "groupId" : "0ae13df90a5c41a7930f46ab7d7936cb",
  "name" : "新增或修改树结构",
  "createTime" : 1727070886980,
  "updateTime" : 1726305782497,
  "lock" : "1",
  "createBy" : "ndmp",
  "updateBy" : "ndmp",
  "path" : "submit",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "{\r\n    \"id\":\"1830880471475687424\",\r\n    \"name\":\"测试新增2 222\"\r\n}",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"status\": 200,\n    \"message\": \"success\",\n    \"data\": 1\n}",
  "description" : "",
  "requestBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  },
  "responseBodyDefinition" : {
    "name" : "",
    "value" : { },
    "description" : "",
    "required" : false,
    "dataType" : "String",
    "type" : "",
    "defaultValue" : "",
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ ]
  }
}
================================
import com.kd.ndmp.util.IdUtil
import cn.hutool.core.util.StrUtil

// 不传id则新增
if (StrUtil.isEmpty(body.id)) {
    return db.table('ndmp_dynamic_model').primary('id').insert({
        id: IdUtil.getSnowflakeNextId(),
        name: body.name,
        type: body.type,
        parent_id: body.parentId
    })
} else {
    return db.table('ndmp_dynamic_model').primary('id').update({
        id: body.id,
        name: body.name,
        type: body.type,
        parent_id: body.parentId
    })
}